<template>
  <div>
    <el-form-item label="结算方式">
      <el-radio-group v-model="formInline.accountType" size="mini">
        <el-radio-button label="1">工时制</el-radio-button>
        <el-radio-button label="2">酬金制</el-radio-button>
      </el-radio-group>
    </el-form-item>
    <el-form-item label="接单">
      <el-button type="primary" size="mini" @click="OnpeopleClick">指派</el-button>
    </el-form-item>

    <!-- 指派员工表格 -->
    <el-table :data="tableData" border size="mini" style="width: 100%">
      <el-table-column prop="date" label="员工姓名" width="180" />
      <el-table-column v-if="formInline.accountType == 1" prop="name" label="工时" width="180">
        <template slot-scope="scope">
          <div>
            <el-input-number v-model="scope.row.num" :min="1" :max="10" label="描述文字" />
          </div>
        </template>
      </el-table-column>
      <el-table-column v-if="formInline.accountType == 2" prop="name" label="酬金" width="180">
        <template slot-scope="scope">
          <div>
            <el-input-number v-model="scope.row.num" :min="1" :max="10" label="描述文字" />
          </div>
        </template>
      </el-table-column>
      <el-table-column prop="address" label="操作">
        <template slot-scope="scope">
          <div>
            <el-button type="text" @click="handleClick(scope.index,scope.row)">指派</el-button>
          </div>
        </template>
      </el-table-column>
    </el-table>
    <!-- 指派员工 -->
    <designate :close.sync="dialog" :options="options" />
  </div>
</template>
<script>
import designate from './components/designate'
import { treeOrgDepartment } from '@/api/customer/orgDepartment'
export default {
  components: {
    designate
  },
  data() {
    return {
      formInline: {
        accountType: 1
      },
      dialog: false,
      tableData: [],
      options: []
    }
  },
  methods: {
    handleClick() {

    },
    OnpeopleClick() {
      this.dialog = true
      treeOrgDepartment().then((res) => {
        this.options = res.data.list
      })
    }
  }
}
</script>
